from appium.webdriver.common.touch_action import TouchAction
from appium import webdriver
from time import sleep
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
import os
from base import Base

class Calender_other(Base):
    def login(self):
        try:
            sleep(2)
            self.driver.find_element_by_xpath("//*[contains(@text,'取消')]").click()
            sleep(2)
            for i in range(2):
                self.swipe_left()
            sleep(2)
            self.swipe_right()
            sleep(2)
            self.driver.find_element_by_xpath("//*[contains(@text,'跳过')]").click()
            text=self.driver.find_element_by_xpath("//*[contains(@text,'登录')]").text
            assert text=='登录'
        except:
            try:
                text = self.driver.find_element_by_xpath("//*[contains(@text,'登录')]").text
                assert text == '登录'
            except:
                text = self.driver.find_element_by_id('com.tal.kaoyan:id/home_fix_item_textview').text
                assert text == '背单词'
    def click(self,locator):
        self.find_element(locator=locator).click()
    def left(self):
        self.swipe_left()
    def right(self):
        self.swipe_left()
